<?php
namespace frontend\controllers;

use Yii;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\helpers\Url;
use yii\web\Controller;
use yii\web\Response;
use yii\base\ErrorException;
use yii\helpers\Html;
use common\models\member\Member;
use common\models\notice\Notice;
use zhongkefu\zhongkefu;
use zhongkefu\helpers\sinaweiboclass;
use frontend\models\FenhuiForm;
use common\models\Setting\Setting;

/**
 *  新浪微博授权登录
 * 
 * @author        dwheng
 */
class SinawbController extends Controller {

    public function actionIndex() { 
		$config = Setting::findBySql('SELECT value FROM setting where code="wb_akey" or code="wb_skey" or code="wb_callback"')->asArray()->all();		
	    $sinawb = new Sinaweiboclass( $config[0]['value'] , $config[1]['value'] );
		$code_url = $sinawb->getAuthorizeURL( $config[2]['value'] );
		$this->redirect($code_url);
    }

}
